package com.lz.fruitday.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.lidroid.xutils.ViewUtils;
import com.lidroid.xutils.view.annotation.ViewInject;
import com.lz.fruitday.R;
import com.lz.fruitday.bean.BaikeHeadBean;
import com.lz.fruitday.utils.ImageLoaderUtil;
import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;

import java.util.List;

/**
 * Created by liuZhi
 * 2015/10/22
 */
public class BaikeHeadAdapter extends AppBaseAdapter<BaikeHeadBean> {
    DisplayImageOptions options;
    public BaikeHeadAdapter(List<BaikeHeadBean> list, Context context) {
        super(list, context);
        options= ImageLoaderUtil.getDefaultOptions();
    }

    @Override
    public ViewHolder getViewHolder(int position, View convertView, ViewGroup parent) {
        BaikeHeadBean headBean=list.get(position);
        ViewHolder vh=ViewHolder.get(context,convertView,parent, R.layout.item_baike_gridview_layout);

        ImageView ivPhoto= (ImageView) vh.findViewById(R.id.photo);
        TextView tvName= (TextView) vh.findViewById(R.id.name);
        TextView tvNum= (TextView) vh.findViewById(R.id.num);

        tvName.setText(headBean.getName());
        tvNum.setText(headBean.getNum());
        ImageLoader.getInstance().displayImage(headBean.getPhoto(),ivPhoto,options);
        return vh;
    }
}
